<template>
    <div class="flex_col_start card m5 p10">
        <label class="flex_center_self">煮珍珠电机</label>
        <div class="flex_row_center mt5">
            <label>位置:</label>
            <el-input v-model="position" clearable style="width: 100px;"/>
            <el-button @click="onClickExec" class="ml5">控制</el-button>
        </div>
    </div>
</template>

<script lang="ts" setup>
import { pearl_motor } from '@/service/devices/heat';
import { runAction } from '@/utils/ui';
import { ref } from 'vue';


const position = ref('0');

async function onClickExec() {
    await runAction('煮珍珠电机', '', async () => {
        const v = parseInt(position.value);
        if (isNaN(v)) {
            throw '请输入位置';
        }
        await pearl_motor(v);
    });
}

</script>
